Cut a little more Windows CP-1252 code.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 7 Jul 2014 04:36:10 +0000 (04:36 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 7 Jul 2014 04:36:10 +0000 (04:36 +0000)
gpsbabel/cet_util.cc
gpsbabel/garmin_txt.cc

index 9a7b09fe895e6b08f567530700c6a5d7ef58bb0e..3122b9a9b7916ff8a7e06b2d84328c7909839065 100644 (file)
@@ -51,18 +51,8 @@ static int cet_output = 0;
 #include "cet/ansi_x3_4_1968.h"
 #include "cet/cp1252.h"
 
-/* %%% short hand strings transmission for main character sets %%% */
 
-char*
-cet_str_utf8_to_cp1252(const char* src)
-{
-  return cet_str_utf8_to_any(src, &cet_cs_vec_cp1252);
-}
-char*
-cet_str_cp1252_to_utf8(const char* src)
-{
-  return cet_str_any_to_utf8(src, &cet_cs_vec_cp1252);
-}
+/* %%% short hand strings transmission for main character sets %%% */
 
 short*
 cet_str_utf8_to_uni(const char* src, int* length)
@@ -151,14 +141,6 @@ cet_cs_alias_qsort_cb(const void* a, const void* b)
   return case_ignore_strcmp(va->name, vb->name);
 }
 
-static signed int
-cet_cs_vec_qsort_cb(const void* a, const void* b)
-{
-  const cet_cs_vec_t* va = *(cet_cs_vec_t**)a;
-  const cet_cs_vec_t* vb = *(cet_cs_vec_t**)b;
-  return case_ignore_strcmp(va->name, vb->name);
-}
-
 void
 cet_register_cs(cet_cs_vec_t* vec)
 {
@@ -208,24 +190,9 @@ cet_register(void)
 #ifdef cet_cs_name_ansi_x3_4_1968
   cet_register_cs(&cet_cs_vec_ansi_x3_4_1968);
 #endif
-#ifdef cet_cs_name_cp1250
-  cet_register_cs(&cet_cs_vec_cp1250);
-#endif
 #ifdef cet_cs_name_cp1252
   cet_register_cs(&cet_cs_vec_cp1252);
 #endif
-#ifdef cet_cs_name_cp1255
-  cet_register_cs(&cet_cs_vec_cp1255);
-#endif
-#ifdef cet_cs_name_iso_8859_1
-  cet_register_cs(&cet_cs_vec_iso_8859_1);
-#endif
-#ifdef cet_cs_name_iso_8859_15
-  cet_register_cs(&cet_cs_vec_iso_8859_15);
-#endif
-#ifdef cet_cs_name_iso_8859_8
-  cet_register_cs(&cet_cs_vec_iso_8859_8);
-#endif
 
   if (cet_cs_vec_ct > 0) {
     cet_cs_vec_t* p;
index ff67ed335b5e6db99679429aec6500d8b29ec98c..722238a1dbb4665eb7a67c10301d1164dc10f829 100644 (file)
@@ -61,6 +61,10 @@ static int current_line;
 static char* date_time_format = NULL;
 static int precision = 3;
 static time_t utc_offs = 0;
+// Having a Windows background, this software encodes degree marks in
+// Windows CP-1252.  We don't attempt to handle all the subtleties of that,
+// but since we write degree marks and we know how they're encoded, use this.
+static const int kDegreeSymbol = 0xB0;
 
 static gtxt_flags_t gtxt_flags;
 
@@ -424,7 +428,7 @@ print_course(const Waypoint* A, const Waypoint* B)          /* seems to be okay */
   if ((A != NULL) && (B != NULL) && (A != B)) {
     int course;
     course = si_round(waypt_course(A, B));
-    cet_gbfprintf(fout, &cet_cs_vec_cp1252, "%d%c true", course, 0xB0);
+    gbfprintf(fout, "%d%c true", course, kDegreeSymbol);
   }
 }
 
@@ -827,9 +831,9 @@ garmin_txt_write(void)
 
   grid_str = xstrdup(gt_get_mps_grid_longname(grid_index, MYNAME));
   while ((c = strchr(grid_str, '*'))) {
-    *c = 0xB0;  /* degree sign */
+    *c = kDegreeSymbol;  /* degree sign */
   }
-  cet_gbfprintf(fout, &cet_cs_vec_cp1252, "Grid\t%s\r\n", grid_str);
+  gbfprintf(fout, "Grid\t%s\r\n", grid_str);
   xfree(grid_str);
 
   datum_str = gt_get_mps_datum_name(datum_index);